<%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" errorPage="" %>
<% 
String tname=null;
String tid=null;
String eidd=(String)session.getAttribute("emp_id");
int eid=Integer.parseInt(eidd);
%>
<%
//String query1="SELECT distinct(t.name),t.task_id FROM project_management.task t,project_management.task_division td where t.project_id='"+pname+"'"+"and t.task_id='"+"(select ta_d.task_id from project_management.task_division ta_d where ta_d.emp_id="+1+")"+"'";
//   String query1="SELECT t.name,t.task_id FROM project_management.task t,project_management.task_division td where t.project_id='"+pid+"'"+"and t.task_id='"+"td.task_id"+"' "+"and td.emp_id='"+eid+"'";
String query1="SELECT distinct(t.name),t.task_id FROM db.task t,db.task_division td where t.task_id="+"td.task_id and td.emp_id='"+eidd+"'";

Connection dbconn = null;
Statement stat = null;
PreparedStatement pstmnt;
ResultSet res;
try{
Class.forName("com.mysql.jdbc.Driver");
String url1= "jdbc:mysql://localhost:3306/db";
dbconn = DriverManager.getConnection( url1,"root", "root" );
stat = dbconn.createStatement();
res=stat.executeQuery(query1);
while (res.next()) { // parse the results
tname=res.getString("t.name");
tid=res.getString("t.task_id");
out.print("<a href='"+"user.jsp?pageid=task&&tid="+tid+"'"+">"+tname+"</a> "+"  "+" ");

}
dbconn.close();
} catch(SQLException e){
e.printStackTrace();
out.println("sql not found");
out.println(e);
} catch(ClassNotFoundException e){
e.printStackTrace();
out.println(e);
}

%>  